1. Using ModelFlow with World Bank models#

The ModelFlow python package has been developed to solve a wide range of models, see the ModelFlow github web site for working examples of the Solow Model, the United States’ Federal REserve FRB/US model and others.

The package has been substantially expanded to include special features that enable it to work with World Bank models originally developed in EViews and designed to use the EViews Model Object for simulation.

This chapter illustrates how to access these models, how to load them into a ModelFlow Anaconda environment on your computer, and how to perform a variety of simulations.

Warning

To be updated when final storage for models is sorted.

1.1. Publicly available World Bank models for use with ModelFlow#

Several World Bank macrostructural models are currently available for download and use with ModelFlow. The available models include:

  • Indonesia (Climate features)

  • Nepal (Climate features)

  • Croatia (Quarterly model)

  • Iraq (Standard Macro-fiscal model)

  • Uganda (Annual model with climate features)

  • Bolivia (Annual model)

  • Pakistan (Annual model with climate features)

These models are developed as part of the World Bank’s outreach efforts. The foundational modeling framework for each model is detailed in Burns et al. [2019], with extensions that cater to the specific characteristics of each modeled country. The approach to modeling climate features is further explained inBurns et al. [2021], noting that some models incorporate additional features not yet documented.

As new models are released, they will be made available through the mechanism described below.

The examples in this book utilize the Pakistan model.

1.2. How to Access the Models#

Users with the ModelFlow library installed can access a GitHub repository containing the World Bank models and notebooks which demonstrate their use. To download the repository, use the following code:

model.Worldbank_Models() 

This command downloads the World Bank models from the GitHub repository at worldbank/MFMod-ModelFlow.

By default, the models are downloaded to ./Worldbank models.

Users can choose a different download location by specifying the destination parameter (defaulting to '.') and the description parameter (defaulting to 'Worldbank models'). For example:

model.Worldbank_Models(destination='./horse', description='blue', reset=True) 

will download the repository to ./horse/blue.

Warning

A repository can only be downloaded once to the same location. If the repository has already been downloaded to a specific location, users can either download it to a new folder by changing the location as described above or use reset=True to delete the folder before the new download. Caution: Using reset=True will delete any new notebooks created in the folder.

Folders containing open notebooks cannot be deleted. Thus, if a previously downloaded notebook is open, it must be closed before attempting to delete the folder.

Warning

Jupyter can only run models in subfolders of the folder from which it was started. Therefore, the destination and description parameters should not specify a location outside the start folder’s subfolders.

Tip

Below will be changed when the wb repo has been populated.

model.Worldbank_Models() 
Menu to start notebooks in subfolders

1.3. .display_toc() Displayed a list of the notebooks in a folder and all its subfolders.#

This this can be used if the user want to display the list of notebooks after the repo has been selected. So the following will display the same as the code above.

model.display_toc(folder= "Worldbank models")
Menu to start notebooks in subfolders

2. To do list#

This JN needs to be finished. Need to

  1. decide on a temporary home for models; done

  2. have that home as part of the default in the widget but allow it to be overridden; done

  3. the display_toc needs to be better documented, notably as to where the user is going to have their models saved on their personal machines and how they can customize that and tell the display_toc where to find them. done

Finally not clear why we have to delete, why cannot user overwrite a repo that was already downloaded? done